package oop.ex3.usercommands;

import java.util.LinkedList;
import oop.ex3.filemanager.FileManager;
import oop.ex3.protocol.GoAway;
import oop.ex3.sharedclasses.IPaddress;

public class FireServers extends UserMessage{

	public static final String COMMAND="FIRESERVERS";
	
	public FireServers(FileManager fileManager) {
		super(fileManager);
	}

	/**
	 * Runs the FirServers UserMessage.
	 * sends GoAway to all known NameServers.
	 */
	public boolean run(){
		LinkedList<IPaddress> nameServers= this._fileManager.getNameServerList();
		GoAway serverFire=new GoAway();
		for (IPaddress nameServer : nameServers){
			serverFire.runAsClient(_fileManager, nameServer, null);
		}
		return SUCCESS;
	}
}
